package annotation;

import annotation.base.UseCase;

import java.util.List;

/**
 * Created by shane on 2018/5/27.
 */
public class PasswordUtils {

    @UseCase(id=47, description = "password must contain at least one numberic")
    public static boolean validatePassword(String password) {
        return (password.matches("\\w*\\d\\w*"));
    }

    @UseCase(id=48)
    public static String encryptPassword(String password) {
        return new StringBuilder(password).reverse().toString();
    }

    @UseCase(id=49, description = "New password can't equal previously used ones")
    public static boolean checkForNewPassword(List<String> prevPasswords, String password) {
        return !prevPasswords.contains(password);
    }


}
